-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paper trade improvements #462
Conversation
c445ccb
to
e62870c
Compare
@algorandpa while i'm testing and reviewing this you might as well make your follow issue(s) for that last bullet and whatever else 🏄🏼 |
piker/pp.py
Outdated
) | ||
from typing import Generator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate import of that Generator
no?
Though i'm sure @guilledk is totally aware of the details, just putting this for myself and the knowledge of others as per the fix landing in #470. Turns out the msging layer seems to be completely fine in terms of zeroing pps despite using floats throughout sizing arithmetic; the issue seems to be purely in our As an example here i was able to get the precision error to linger in the [binance.paper."btcusdt.binance"]
size = 2.7755575615628914e-17
ppu = 23489.324999999997
bsuid = "btcusdt"
clears = [
{ dt = "2023-02-28T18:36:42.360930+00:00", ppu = 23455.5, accum_size = -0.04264, price = 23455.5, size = -0.04264, cost = 0, tid = "34323ca0-277b-4f9f-b77e-1ef4718c49c5" },
{ dt = "2023-02-28T18:36:44.500479+00:00", ppu = 23456.435, accum_size = -0.08528, price = 23457.37, size = -0.04264, cost = 0, tid = "9996508c-b94b-489f-910f-c9360c9ce031" },
{ dt = "2023-02-28T18:36:46.400183+00:00", ppu = 23456.00666666667, accum_size = -0.12791999999999998, price = 23455.15, size = -0.04264, cost = 0, tid = "15dfe435-d54b-450d-b1ec-21db6e535c17" },
{ dt = "2023-02-28T18:38:37.989248+00:00", ppu = 23462.75, accum_size = 2.7755575615628914e-17, price = 23462.75, size = 0.12792, cost = 0, tid = "138dcf2b-5ab9-43b3-bb45-0465da730ac9" },
{ dt = "2023-02-28T18:44:02.788944+00:00", ppu = 23480.89, accum_size = 0.04258000000000003, price = 23480.89, size = 0.04258, cost = 0, tid = "e098b4d2-72b2-41a9-b1f4-e74f6c457c56" },
{ dt = "2023-02-28T18:44:11.890799+00:00", ppu = 23480.89, accum_size = 2.7755575615628914e-17, price = 23482.39, size = -0.04258, cost = 0, tid = "672167d1-ee78-4e54-91a6-7fc63f96349f" },
{ dt = "2023-02-28T18:44:41.429072+00:00", ppu = 23491.16, accum_size = 0.042570000000000024, price = 23491.16, size = 0.04257, cost = 0, tid = "df3eeead-e6ad-477a-9720-c5143ace03cf" },
{ dt = "2023-02-28T18:44:44.812730+00:00", ppu = 23489.324999999997, accum_size = 0.08514000000000002, price = 23487.49, size = 0.04257, cost = 0, tid = "30f471e6-e1c0-484b-91cd-cd9c9aec8804" },
{ dt = "2023-02-28T18:44:48.019707+00:00", ppu = 23489.324999999997, accum_size = 0.042570000000000024, price = 23488.71, size = -0.04257, cost = 0, tid = "6f6f2a34-3fe0-436b-9896-4874172cbfc2" },
{ dt = "2023-02-28T18:45:31.141610+00:00", ppu = 23489.324999999997, accum_size = 2.7755575615628914e-17, price = 23480.55, size = -0.04257, cost = 0, tid = "46440830-caed-4b76-b6b3-0ac27fa7b054" },
] |
remove duplicate import
format function calls
Add extra line in conftest
9e2ac6d
to
1323981
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lookin good enuf to me!
Nice work; super stoked to have a suite to start hardening our clearing layer and refining our order ctl APIs 🏄🏼
Land when y'all are ready.
Test suite todo:
pps.toml
, stop and startpikerd
, ensure the pp is relayed onopen_ems()
connectBrokerdPosition
state as per the comment Paper trade improvements #462 (comment), as such we need to add test code to process thetrade_stream: tractor.MsgStream
msgs and ensure the eventual last position msg matches the state in thepps.toml
Future dark-order and alert storage todo test suite (maybe to do in a follow up PR):
submit an order that does not clear, stop and start=> deferred to #463pikerd
, ensure order is re-registered inemsd
will likely requires=> deferred to #464Order
serialization to file system and load